package router

import (
	systemController "gitee.com/wangshh_123/cross-pay-go/src/controller/system"
	"gitee.com/wangshh_123/cross-pay-go/src/middleware"

	"github.com/gin-gonic/gin"
)

// SetupBalanceSyncRoutes 设置余额同步路由
func SetupBalanceSyncRoutes(r *gin.Engine) {
	balanceSyncController := systemController.NewBalanceSyncController()

	// 余额同步路由组
	balanceSyncGroup := r.Group("/api/balance-sync")
	balanceSyncGroup.Use(middleware.AuthMiddleware())
	{
		// 获取卡片余额
		balanceSyncGroup.GET("/card/:cardId/balance", balanceSyncController.GetCardBalance)

		// 更新卡片余额
		balanceSyncGroup.PUT("/card/:cardId/balance", balanceSyncController.UpdateCardBalance)

		// 根据用户ID更新卡片余额
		balanceSyncGroup.PUT("/user/:userId/card/:cardId/balance", balanceSyncController.UpdateCardBalanceByUser)

		// 列出余额为0的卡片
		balanceSyncGroup.GET("/cards/zero-balance", balanceSyncController.ListCardsWithZeroBalance)

		// 按平台列出卡片
		balanceSyncGroup.GET("/cards/platform/:platform", balanceSyncController.ListCardsByPlatform)

		// 获取余额统计信息
		balanceSyncGroup.GET("/summary", balanceSyncController.GetBalanceSummary)
	}
}
